package com.cn.xiaonuo.slbfinances.slbreward.controller;

import com.cn.xiaonuo.common.entity.BusinessMessage;
import com.cn.xiaonuo.slbfinances.slbreward.service.ICoverageRewardActivityService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
public class CoverageRewardController {
    @Resource
    private ICoverageRewardActivityService coverageRewardActivityService;

    @ApiOperation(value = "中奖列表--列表", notes = "中奖列表--列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "phone", value = "手机号码（String）"),
            @ApiImplicitParam(name = "name", value = "姓名（String）"),
            @ApiImplicitParam(name = "start", value = "开始时段（Integer）"),
            @ApiImplicitParam(name = "end", value = "结束时段（Integer）"),
            @ApiImplicitParam(name = "pageNo", value = "第几页（Integer）", required = true),
            @ApiImplicitParam(name = "pageSize", value = "每页长度（Integer）", required = true)
    })
    @RequestMapping(value = "/api/coveragereward/getRewardList", method = RequestMethod.POST)
    public BusinessMessage getRewardList(String phone, String name, Integer start, Integer end, Integer pageNo, Integer pageSize) {
        return coverageRewardActivityService.getRewardList(phone, name, start, end, pageNo, pageSize);
    }

    @ApiOperation(value = "中奖列表--生产中奖记录", notes = "中奖列表--生产中奖记录")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "startDate", value = "活动开始日期（String）"),
            @ApiImplicitParam(name = "start", value = "开始时间（Integer）"),
            @ApiImplicitParam(name = "end", value = "结束时间（Integer）")
    })
    @RequestMapping(value = "/api/coveragereward/genRewardRecords", method = RequestMethod.POST)
    public BusinessMessage genRewardRecords(String startDate, Integer start, Integer end) {
        return coverageRewardActivityService.generateRewardRecords(startDate, start, end);
    }
}
